<%!

  Copyright (c) Facebook, Inc. and its affiliates.

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.

%><%#struct:is_large?%>
THRIFT_IGNORE_ISSET_USE_WARNING_BEGIN
<%struct:name%>::<% > module_types_h/base_ctor%>
THRIFT_IGNORE_ISSET_USE_WARNING_END

<%#struct:cpp_noexcept_move_ctor%>
<%#struct:fields?%>
<% > module_types_cpp/move_ctor%>
<%/struct:fields?%>
<%/struct:cpp_noexcept_move_ctor%>

<%struct:name%>::~<%struct:name%>() {}

<%/struct:is_large?%>
<% > module_types_cpp/fragile_ctor%>

void <%struct:name%>::__clear() {
  // clear all fields
<%#struct:fields%><%#field:type%>
<%#type:resolves_to_base_or_enum?%>
<%#field:value%>
<%^type:enum?%>
  <% > types/apply_indirection_pre%><%field:cpp_name%><% > types/apply_indirection_post%> = <% > common/cxx_value_prefix%><% > common/iterate_const_values%><% > common/cxx_value_suffix%>;
<%/type:enum?%>
<%#type:enum?%>
<%#value:enum?%>
  <% > types/apply_indirection_pre%><%field:cpp_name%><% > types/apply_indirection_post%> = <% > common/cxx_value_prefix%><% > common/iterate_const_values%><% > common/cxx_value_suffix%>;
<%/value:enum?%>
<%^value:enum?%><%#field:enum_has_value%>
  <% > types/apply_indirection_pre%><%field:cpp_name%><% > types/apply_indirection_post%> = <% > common/type_namespace_cpp2%><%type:name%>::<%enumValue:cpp_name%>;
<%/field:enum_has_value%><%/value:enum?%>
<%^value:enum?%><%^field:enum_has_value%>
  <% > types/apply_indirection_pre%><%field:cpp_name%><% > types/apply_indirection_post%> = static_cast<<% > common/type_namespace_cpp2%><%type:name%>>(<% > common/const_value%>);
<%/field:enum_has_value%><%/value:enum?%>
<%/type:enum?%>
<%/field:value%>
<%^field:value%>
  <% > types/apply_indirection_pre%><%field:cpp_name%><% > types/apply_indirection_post%> = <% > module_types_cpp/unset_values%>;
<%/field:value%>
<%/type:resolves_to_base_or_enum?%>
<%#type:resolves_to_container?%>
<%#field:cpp_ref?%>
<%^field:optional?%>
  <%field:cpp_name%>.reset(new typename decltype(<%field:cpp_name%>)::element_type());
<%/field:optional?%>
<%#field:optional?%>
  <%field:cpp_name%>.reset();
<%/field:optional?%>
<%/field:cpp_ref?%>
<%^field:cpp_ref?%>
  <%field:cpp_name%>.clear();
<%/field:cpp_ref?%>
<%/type:resolves_to_container?%>
<%#type:non_empty_struct?%>
<%^field:cpp_ref?%>
  <%field:cpp_name%>.__clear();
<%/field:cpp_ref?%>
<%#field:cpp_ref_unique?%>
<%^field:optional?%>
  if (<%field:cpp_name%>) <%field:cpp_name%>->__clear();
<%/field:optional?%>
<%#field:optional?%>
  <%field:cpp_name%>.reset();
<%/field:optional?%>
<%/field:cpp_ref_unique?%>
<%#field:cpp_ref_shared?%>
<%^field:optional?%>
  if (<%field:cpp_name%>) <%field:cpp_name%>->__clear();
<%/field:optional?%>
<%#field:optional?%>
  <%field:cpp_name%>.reset();
<%/field:optional?%>
<%/field:cpp_ref_shared?%>
<%#field:cpp_ref_shared_const?%>
<%^field:optional?%>
  if (<%field:cpp_name%>) <%field:cpp_name%>.reset(new typename decltype(<%field:cpp_name%>)::element_type());
<%/field:optional?%>
<%#field:optional?%>
  <%field:cpp_name%>.reset();
<%/field:optional?%>
<%/field:cpp_ref_shared_const?%>
<%/type:non_empty_struct?%>
<%/field:type%><%/struct:fields%>
<%#struct:isset_fields?%>
THRIFT_IGNORE_ISSET_USE_WARNING_BEGIN
  __isset = {};
THRIFT_IGNORE_ISSET_USE_WARNING_END
<%/struct:isset_fields?%>
}
